package com.itheima.controller;

import com.itheima.domain.vo.AddressVO;
import com.itheima.service.AddressService;
import com.itheima.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;
import java.util.List;

@RestController
@Api(tags = "地址相关的接口")
@RequestMapping("/address")
@Slf4j
public class AddressController {
    @Autowired
    private AddressService addressService;
    /**
     * 获取岗位地区数据
     * @return
     */
    @GetMapping("/category")
    @ApiOperation("获取岗位地区数据")
    public Result<List<AddressVO>> category(String category,String city) throws SQLException {
        log.info("category={},city={}", category,city);
        List<AddressVO> result= addressService.category(category,city);
        return Result.success(result);
    }
}
